feat(engine): workflow interpolation for ${input.*} and ${steps.*} (issue #16)#50
Merged
Merged
Conversation
Add Context, StepResult, InterpolateString, and InterpolateWalk for
${input.*} and ${steps.<id>.output|meta.*} per design doc §13.1–§13.2.
Errors report undefined paths and type mismatches when drilling into
non-map values.
Tests cover §7.4-style repo/number, nested output.summary, meta, and
unknown placeholder handling (issue #16).
Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements MVP workflow string interpolation from the design doc §13.1 (dot paths only, non–Turing-complete):
${input...}and${steps...}against a small run context, with §13.2 step result shape (output,meta).API (
internal/engine/interpolation.go)StepResult:Output any,Meta map[string]any(maps hold nested fields for dot lookup).Context:Input map[string]any,Steps map[string]StepResult.InterpolateString(s, ctx): finds${...}tokens (inner path trimmed), resolves paths, substitutes string values (scalars formatted; objects/arrays JSON-encoded).InterpolateWalk(v, ctx): recursively interpolates string leaves inmap[string]anyand[]any(for workflowwithtrees).Path rules
input.<key>[.<nested>...]— walkContext.Input.steps.<step_id>.output[.<nested>...]orsteps.<step_id>.meta.<key>...— walkStepResult.Output/Metaasmap[string]any; drilling into non-maps returns a clear error.Errors
undefined pathorunknown stepwhere applicable (validation-friendly for callers).cannot resolvewith%T.Tests
repo=${input.repo},number=${input.number}, whole${steps.fetch_pr.output}, nested${steps.review.output.summary},${steps.fetch_pr.meta.durationMs}.${input.unknown_key}.${}, whitespace inside token,InterpolateWalkon nested maps.Verification
make fmt(go fmt ./...)make test(go test ./... -race)make vetCloses #16
Made with Cursor